package org.starsource.forum.client.exception;

import com.google.gwt.core.client.GWT;

public class ExceptionDescription {
	private static final ExceptionConstants exceptionConstants = (ExceptionConstants) GWT.create(ExceptionConstants.class);
	
	public static String getDescription(Throwable exception) {
		if (UserNotFoundException.class.equals(exception.getClass())) return exceptionConstants.userNotFoundException();
		if (DatabaseException.class.equals(exception.getClass())) return exceptionConstants.databaseException();
		if (ServerException.class.equals(exception.getClass())) return exceptionConstants.serverException();
		if (CategoryNotFoundException.class.equals(exception.getClass())) return exceptionConstants.categoryNotFoundException();
		if (LoginFailNotFoundException.class.equals(exception.getClass())) return exceptionConstants.loginFailNotFoundException();
		if (LoginLogNotFoundException.class.equals(exception.getClass())) return exceptionConstants.loginLogNotFoundException();
		if (MessageNotFoundException.class.equals(exception.getClass())) return exceptionConstants.messageNotFoundException();
		if (ResourceNotFoundException.class.equals(exception.getClass())) return exceptionConstants.resourceNotFoundException();
		if (SessionNotFoundException.class.equals(exception.getClass())) return exceptionConstants.sessionNotFoundException();
		return exception.getMessage();
	}

}
